VBA DOORS and ADDINS variable

So, I've been beating my head against a wall for quite some time trying to figure this out, and I'm sure someone on this forum has probably done it already.

The problem is twofold:

1. I am attempting to open DOORS from System Architect using the VBA interface, which is bafflingly simplistic. I want to specify the addins path, but I can't seem to figure out any way to do that using the CreateObject VBA function. I have tried sending a DXL command to the DOORS client to set the "DOORSADDINS" environment variable using the setenv DXL function. Unfortunately, this function does nothing for the current instance of DOORS. The only other solution I can think of right now is to place a requirement on my users that they must already have DOORS open having launched it using the correct icon that has the right addins path.

2. The CreateObject function does not wait for the user to log in to DOORS. It just creates the application instance and calls it done. Unfortunately, that means any further interaction with the application fails because we are not logged in yet. My first thought was to add a sleep function call in there, but that seems like a bad solution. The only other solution I can think of is, again, to tell the user to log in to DOORS first before running the VBA application.

 

Have any of you already solved this problem somewhere along the way and remember your solution or maybe have any suggestions. Thanks.


CosmicCoder86 - Mon Aug 13 14:28:03 EDT 2018

Re: VBA DOORS and ADDINS variable
Mathias Mamsch - Tue Aug 14 03:44:39 EDT 2018

1. Modifying the DOORS Search path at runtime is only possible through bad hacks, that you probably do not want to employ in a production environment. A possibility is to have the VBA macros use a different set of scripts with absolute include paths. In this case the ADDINS does not matter so much anymore. Note that  doors/lib/dxl is always on the include path. If you can deploy your scripts there, you shall be good. Another opportunity is to have the VBA or a DXL script put an addins path (e.g. LAYOUTADDINS) to the registry. This way it will not interfere with the icons but still be used on all DOORS clients.

2. In another setting we used the System.Process.WaitForInputIdle function (see this thread: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014458173&ps=25) to wait for the startup of DOORS. Maybe it works too?

You should think about instead of starting DOORS over COM giving you no control over ADDINS nor Login, to ask the user for credentials from System Architect and Start DOORS as in the above thread using the shell passing the credentials over the commandline. Then you can not only pass the correct ADDINS parameters, but also wait until the GUI has started up correctly (as login will be done automatically).

If you find you cannot do certain stuff over VBA, think about creating an external executable (e.g. in C# from the above code) to launch DOORS for you, then launch it using VBA, afterwards get a handle to the DOORS COM with getObject and you should be fine.

Maybe that helps, regards, Mathias

Re: VBA DOORS and ADDINS variable
CosmicCoder86 - Tue Aug 14 16:39:03 EDT 2018

Mathias Mamsch - Tue Aug 14 03:44:39 EDT 2018

1. Modifying the DOORS Search path at runtime is only possible through bad hacks, that you probably do not want to employ in a production environment. A possibility is to have the VBA macros use a different set of scripts with absolute include paths. In this case the ADDINS does not matter so much anymore. Note that  doors/lib/dxl is always on the include path. If you can deploy your scripts there, you shall be good. Another opportunity is to have the VBA or a DXL script put an addins path (e.g. LAYOUTADDINS) to the registry. This way it will not interfere with the icons but still be used on all DOORS clients.

2. In another setting we used the System.Process.WaitForInputIdle function (see this thread: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014458173&ps=25) to wait for the startup of DOORS. Maybe it works too?

You should think about instead of starting DOORS over COM giving you no control over ADDINS nor Login, to ask the user for credentials from System Architect and Start DOORS as in the above thread using the shell passing the credentials over the commandline. Then you can not only pass the correct ADDINS parameters, but also wait until the GUI has started up correctly (as login will be done automatically).

If you find you cannot do certain stuff over VBA, think about creating an external executable (e.g. in C# from the above code) to launch DOORS for you, then launch it using VBA, afterwards get a handle to the DOORS COM with getObject and you should be fine.

Maybe that helps, regards, Mathias

Mathias. Thank you for your response and all that you do for the DXL community.

At your suggestion I went ahead and wrote a GUI that prompts the user for their DOORS credentials. Upon clicking OK I then use the VBA Shell function to open DOORS, passing the username, password, server name, and addins path. Handling the possibility that the user entered invalid data in the credentials GUI and the possibility that DOORS is already open (assuming the user opened an instance with the correct addins path), I now have no requirement on my user that they either do or do not have DOORS open upon executing our VBA application.

I think this turned out to be a pretty slick solution. Thank you so much for your help.